// String str;
// str = 'abc'; // 正确
// str = 2; // 报错

public abstract class Animal {
    abstract void makeSound();
}

public class Duck extends Animal {
    public void makeSound () {
        system.out.print('嘎嘎嘎');
    }
}

public class Chicken extends Animal {
    public void makeSound() {
        system.out.print('咯咯咯');
    }
}

public class AnimalSound {
    public void makeSound(Animal animal) {
        animal.makeSound();
    }
}

public class Test {
    public static void main (String args[]) {
        AnimalSound animalSound = new AnimalSound();
        // Duck duck = new Duck();
        // animalSound.makeSound(duck); // 输出 嘎嘎嘎
        Animal duck = new Duck();
        animalSound.makeSound(duck);
        Animal chicken = new Chicken();
        animalSound.makeSound(chicken);
    }
}